home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / COMM.SWG / 0037_Carrier Detect.pas < prev    next >
Pascal/Delphi Source File  |  1994-01-27  |  947b  |  39 lines

  1.  
  2. unit cdchk;
  3.  
  4. Interface
  5.  
  6.  Function CarrierDetected( ComPort : byte ) : Boolean;
  7.  
  8. Implementation
  9.  
  10.  Function CarrierDetected( ComPort : byte ) : Boolean;
  11.  
  12.  Const MSR      = 6;
  13.  
  14.  VAR
  15.        BASEPORT : Array[0..3] Of Word absolute $40:0;
  16.  
  17.  VAR   P : Word;
  18.  
  19.  begin
  20.    CarrierDetected := FALSE;    { Assume no Carrier }
  21.    dec( ComPort );
  22.    if ComPort in [0..3] then    { range check for COMx }
  23.    begin                        { ... not valid ? }
  24.      P := BasePort[ComPort];    { Bios-Var for COMx... }
  25.      If P <> 0 then             { ... not assigned ?! }
  26.      begin
  27.        CarrierDetected := (Port[P+ MSR] And $80) = 0;
  28.      end;
  29.    end
  30.  end;
  31.  { No Initializing ... }
  32.  end.
  33.  
  34. -------------------------------------------------------------
  35.  P.S.:  If P=0 ...
  36.    Port[P+MSR] ==> Port[6]
  37.    this would read the DMA Channel#3-LowAdress-Byte .... (:-))
  38. -------------------------------------------------------------
  39.